# Maintainer: Alexey Pavlov <alexpux@gmail.com>
# Contributor: AlexWMF <alexxwmf@gmail.com>

_realname=qjson
pkgbase=mingw-w64-${_realname}-qt4
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}-qt4"
pkgver=0.8.1
pkgrel=3
pkgdesc="QJson is a qt-based library that maps JSON data to QVariant objects (mingw-w64)"
arch=('any')
license=('GPL')
url="http://qjson.sourceforge.net"
depends=("${MINGW_PACKAGE_PREFIX}-qt4")
makedepends=("${MINGW_PACKAGE_PREFIX}-cmake" "${MINGW_PACKAGE_PREFIX}-gcc")
install=${_realname}-qt4-${CARCH}.install
options=(!strip staticlibs !buildflags)
source=(${_realname}-${pkgver}.tar.gz::"https://github.com/flavio/${_realname}/archive/${pkgver}.tar.gz")
sha256sums=('920c94166cb91b1cf11c7d2745bdbcc8c0ea82411ca7b3732ce0b00ee2d56e98')

build() {
  mkdir ${srcdir}/build-${MINGW_CHOST}
  cd ${srcdir}/build-${MINGW_CHOST}

  MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
  ${MINGW_PREFIX}/bin/cmake \
    -G"MSYS Makefiles" \
    -DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \
    -DCMAKE_BUILD_TYPE=Release \
    ${srcdir}/${_realname}-${pkgver}

  make # VERBOSE=1
}

package() {
  cd ${srcdir}/build-${MINGW_CHOST}
  make DESTDIR=${pkgdir} install
}
